package com.tczs.shardjdbcdemo.controller;

import com.tczs.shardjdbcdemo.mapper.OrderMapper;
import com.tczs.shardjdbcdemo.model.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author ：tao.li
 * @description：
 * @date ：Created in 2023/3/18 10:56
 */
@Slf4j
@RestController
public class OrderController {

    @Autowired
    private OrderMapper orderMapper;

    @Transactional
    @GetMapping("/test")
    public String test(){
        log.info("1111111");
        Order order = new Order();
        order.setGoodsName("测试-1000");
        order.setAmount("11");
        order.setCreateTime(new Date());
        orderMapper.insert(order);
        int i = 1/0;
        return "200";
    }
}
